<template>
	<view class="container">
		<uni-section title="图" sub-title="" type="line">
			<image :src="'http://localhost:8090/'+food.icon" mode=""></image>
		</uni-section>
		<uni-section title="名称" sub-title="" type="line">
			<view class="">{{food.name}}</view>
		</uni-section>
		<uni-section title="类别" sub-title="" type="line">
			<view class="">{{food.type}}</view>
		</uni-section>
		<uni-section title="价格" sub-title="" type="line">
			<view class="">{{food.price}}</view>
		</uni-section>
		<uni-section title="描述" sub-title="" type="line">
			<view class="">{{food.description}}</view>
		</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				food:{},
				id:''
			}
		},
		methods: {
			get(){
				uni.request({
					url: 'http://localhost:8090/foodapp/food/findone',
					method: 'POST',
					data: {
						id:this.id
					},
					success: res => {
						if(res.data.success){
							this.food=res.data.data
						}
					},
					fail: () => {},
					complete: () => {}
				});
			}
		},
		onLoad: function(option) {
			this.id=option.id
			console.log(this.food);
		},
		onShow() {
			this.get()
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
